<!--
 * @Author: your name
 * @Date: 2020-02-22 16:56:44
 * @LastEditTime: 2022-01-11 15:50:47
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \yjhlc:\Users\zhamgzifang\Desktop\wqd\app1\src\App.vue
 -->
<template>
  <div id="app">
    <div id="nav">
      <router-link to="/api2">8082端口</router-link> |
      <router-link to="/api2/about">8082端口</router-link> |
      <router-link to="/api1/">8081Home</router-link> |
      <router-link to="/api1/about">8081About</router-link>
      <a @click="setMessage">应用通信</a>
    </div>
    <!-- <router-view/> -->
    <div v-html="content"></div>
  </div>
</template>
  
<script>
import actions from './shared/actions'
export default {
  name: '',
  props:['content'],
  created(){
  },
  components: {
    // HelloWorld
  },
  mounted(){
    if(window.__POWERED_BY_QIANKUN__){
      
    }
  },
  methods:{
    setMessage(){
      actions.setGlobalState({ token: "111111" });
    //  if (window.__POWERED_BY_QIANKUN__) {
    //       // 使用了qiankun微前端，则使用actions通信
    //     actions.setGlobalState({ token: "111111" });
    //   } 
    //   // else {
    //   //     // 子项目单独运行时，则直接使用Vuex通信
    //   //   this.$store.commit("user/setToken", "111111");
    //   // }
    }
  }
}
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
